package com.ay.weixin.config;

import java.util.HashMap;
import java.util.Map;

import org.lizar.config.keys.Keys;
import org.lizar.ioc.module.Module;
import org.lizar.util.StringHelper;

import com.ay.weixin.fdc.boss.bank.domain.BankAccount;

public class AppConfig extends Module {
	
	public static Map<String, Boolean>	img_support_fix	= new HashMap<String, Boolean>();
	
	@Override
	public void init_property() throws Exception {
		//通用配置
		Keys.set("URL_TO_CREATE_MENU", "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=%s");
		Keys.set("URL_TO_QUERY_MENU", "https://api.weixin.qq.com/cgi-bin/menu/get?access_token=%s");
		Keys.set("URL_TO_DELETE_MENU", "https://api.weixin.qq.com/cgi-bin/menu/delete?access_token=%s");
		Keys.set("AcessTokenUrl", "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s");
		Keys.set("msg_template", "/WEB-INF/weixin_template/auto_reply/msg/%s.vm");
		Keys.set("menu.name_max_length", 40);
		Keys.set("menu.key_max_length", 16);
		Keys.set("menu.url_max_length", 255);
		Keys.set("menu_sub.name_max_length", 40);
		Keys.set("bank.name_max_length", 12);
		Keys.set("bank.account_max_length", 20);
		Keys.set("bank.remark_max_length", 50);
		Keys.set("bank.default_staus", BankAccount.STATUS_OK);
		Keys.set("auto_reply.news_msg_description_length", 50);
		Keys.set("auto_reply.text_msg_conetnt_length", 680);
		Keys.set("auto_reply.news_msg_title_length", 40);
		Keys.set("auto_reply.url_max_length", 255);
		Keys.set("auto_reply.image_file_upload_foler", "/upload/image/");
		Keys.set("auto_reply.one_msg_max_news", 9);
		Keys.set("fdc_usercenter.register_password_min_length", 6, "密码长度大于等于6个字符");
		Keys.set("fdc_usercenter.register_password_max_length", 8, "密码最大长度不超过8个字符");
		Keys.set("fdc_usercenter.register_phone_length", 11, "请输入11位手机号码");
		Keys.set("fdc_usercenter.register_name_max_length", 12, "姓名最大长度不超过12个字符");
		Keys.set("fdc_usercenter.register_name_min_length", 2, "姓名至少2个字符");
		Keys.set("fdc_usercenter.register_return", "新用户奖励");
		Keys.set("fdc_usercenter.register_invite_return", "邀请(%s)奖励");
		Keys.set("usercenter.session_timeout", "2592000", "session过期时间，为负数表示永不过期，单位为秒");
		Keys.set("forward.user_login_default_url", "/fdc/login/");
		Keys.set("forward.user_login_old_default_url", "/fdc/login/old/");
		Keys.set("forward.user_register_default_url", "/fdc/register/");
		Keys.set("forward.user_register_old_default_url", "/fdc/register/old/");
		Keys.set("forward.usercenter_default_url", "/fdc/usercenter/");
		Keys.set("forward.not_fdc_user", "/share/");
		Keys.set("weixin.code_base_retreive_url", "https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect");
		Keys.set("weixin.code_retreive_url", "https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect");
		Keys.set("weixin.access_token_url", "https://api.weixin.qq.com/sns/oauth2/access_token?appid=%s&secret=%s&code=%s&grant_type=authorization_code");
		Keys.set("weixin.user_info_url", "https://api.weixin.qq.com/sns/userinfo?access_token=%s&openid=%s&lang=zh_CN");
		Keys.set("fdc_usercenter.image_post_fix_support", "jpg,jpeg,png");
		Keys.set("kanfang.flow_remark_length_in_backend", 200, "状态修改备注字段最大长度");
		Keys.set("kanfang.gohousedate_length_in_backend", 100, "看房日期字段最大长度");
		Keys.set("fdc_map.baidu_static_map_url", "http://api.map.baidu.com/staticimage", "百度静态图url路径");
		Keys.set("fdc_map.baidu_dynamic_map_url", "http://api.map.baidu.com/marker?location=%s&title=%s&content=%s&output=html", "百度动态图url路径");
		Keys.set("fdc_project_validation.title_max_length", 40,"房地产项目标题最大长度");
		Keys.set("share.back_hits_annoucement_top", 50,"公布最高分几个客户");
		Keys.set("usercenter.my_invite_list_first_page_size", 100);
		Keys.set("usercenter.user_table_name", "fdc_user","用户表名");
		Keys.set("template_reply.post_reply_url", "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=%s");
		Keys.set("weixin_url.get_user_info", "https://api.weixin.qq.com/cgi-bin/user/info?access_token=%s&openid=%s", "通过相对openid,获取用户信息");
		Keys.set("input_message_event_type.subscribe", "subscribe");
		Keys.set("input_message_event_type.unsubscribe", "unsubscribe");
		Keys.set("input_message_event_type.SCAN", "SCAN");
		Keys.set("input_message_event_type.LOCATION", "LOCATION");
		Keys.set("input_message_event_type.VIEW", "VIEW");
		Keys.set("input_message_event_type.CLICK", "CLICK");
		Keys.set("duokefu.msg_template", "/WEB-INF/weixin_template/auto_reply/duokefu/transfer_msg.vm");
		Keys.set("fdc_kanfang.remark_max_length", 100);
		Keys.set("input_message.pick_user_info", "input", "备选值:input或subscribe，表示在那种情况下采集用户数据，当有input消息时，还是用户关注时");
		Keys.set("sys_page_size", 10,"后台每页用户多少条数据");
		//平台集成配置

		
	}
	
	private void support_img_fix_load() {
		String args = Keys.getStr("fdc_usercenter.image_post_fix_support");
		if (StringHelper.isNull(args))
			args = "jpg";
		String[] fix = args.split(",");
		for (String i : fix) {
			img_support_fix.put(i, true);
		}
	}
	
	@Override
	public void init_component() throws Exception {
		support_img_fix_load();
		
	}
	
	
	
}
